package Users.Role;

import Users.User;
import service.impl.AddBookIOperation;
import service.impl.DeleteBookIOperation;
import service.impl.FindBookInfoIOperation;
import service.impl.ModifyBookIOperation;

public class Administrator extends User {
    protected String name;
    public Administrator(String name) {
        this.name = name;
    }
    /**
     * 为系统用户赋予相应权限
     */
    static {
        operations.add(new AddBookIOperation());
        operations.add(new FindBookInfoIOperation());
        operations.add(new ModifyBookIOperation());
        operations.add(new DeleteBookIOperation());
    }

    /**
     * 设置管理员界面
     * @return
     */
    public int UI() {
        System.out.println("***************************************************");
        System.out.println("1.添加图书信息.");
        System.out.println("2.查询所有图书信息.");
        System.out.println("3.修改图书信息.");
        System.out.println("4.删除图书信息.");
        System.out.println("5.退出管理系统.");
        System.out.println("请输入相应序号来进行序号对应的操作！");
        System.out.println("***************************************************");
        int operation = scanner.nextInt();
        if (operation == 5) {
            // 关闭输入流！
            scanner.close();
        }
        return operation;
    }
}
